 <?php
    class My_Controller_Helper_Acl
    {
	    public $acl;
	    
	    public function __construct()
	    {
	    	$this->acl = new Zend_Acl();
	    }
	    
	    public function setRoles()
	    {
		    $this->acl->addRole(new Zend_Acl_Role('1')); //guest
		   	$this->acl->addRole(new Zend_Acl_Role('2')); //users 
		    $this->acl->addRole(new Zend_Acl_Role('3')); //admin
	    }
	
	    public function setResources()
	    {
		    $this->acl->add(new Zend_Acl_Resource('viewArticle'));
		    $this->acl->add(new Zend_Acl_Resource('addArticle'));
		    $this->acl->add(new Zend_Acl_Resource('deleteArticle'));
		    $this->acl->add(new Zend_Acl_Resource('editArticle'));
		    $this->acl->add(new Zend_Acl_Resource('addComments'));
		    $this->acl->add(new Zend_Acl_Resource('deleteComments'));
		    $this->acl->add(new Zend_Acl_Resource('listArticle'));
	    }
	
	    public function setPrivilages()
	    {
		    $this->acl->allow('1',null,'viewArticle');
		    $this->acl->allow('2',array('viewArticle','addComments'));
		    $this->acl->allow('3',array('viewArticle','addComments','deleteComments','editArticle','deleteArticle','addArticle','listArticle'));

	    }
	    
	    public function setAcl()
	    {
		    Zend_Registry::set('acl',$this->acl);
	    }
	}
?>